<?php
/**
 * 控制器基类
 */
class baseAction extends Action
{
	protected $img_save_path='';
	protected $ueditor_save_path='';
    protected function _initialize() {
        //消除所有的magic_quotes_gpc转义
        Input::noGPC();
        //初始化网站配置
        if (false === $setting = F('setting')) {
            $setting = D('setting')->setting_cache();
        }
        C($setting);
        //设置图片存放位置
		$this->img_save_path='./'.C('zyb_attach_path').'images/';//处理图片的路径

    }
    protected function _404($url = '') {
    	   header("HTTP/1.0 404 Not Found");
           IS_AJAX && $this->ajaxReturn(0,'您访问的页面不存在');
           if(IS_AJAX){
             $this->ajaxReturn(0,'!!很抱歉,请求资源未找到');
           }else{
              $this->display(C('404_PATH'));
           }
           exit();
    }
    /**
     * AJAX返回数据标准
     *
     * @param int $status
     * @param string $msg
     * @param mixed $data
     * @param string $dialog
     */
    protected function ajaxReturn($status=1, $msg='', $data='', $dialog='') {
        parent::ajaxReturn(array(
            'status' => $status,
            'msg' => $msg,
            'data' => $data,
            'dialog' => $dialog,
        ));
    }
     /**
     * 前台分页统一
     */
    protected function _pager($count, $pagesize) {
        $pager = new Page($count, $pagesize);
        $pager->rollPage = 5;
        $pager->setConfig('prev', '<');
        $pager->setConfig('next', '>');
        $pager->setConfig('theme', '%upPage% %first% %linkPage% %end% %downPage%');
        return $pager;
    }
	
	
}